-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DiscoverInfo() as thin wrapper around RawInformation() #151
base: master
Are you sure you want to change the base?
Conversation
@mdosch Could you please handle this? |
Will have a look when I find the time. |
func (c *Client) DiscoverNodeInfo(node string) (string, error) { | ||
query := fmt.Sprintf("<query xmlns='%s' node='%s'/>", XMPPNS_DISCO_INFO, node) | ||
return c.RawInformation(c.jid, c.domain, "info3", IQTypeGet, query) | ||
} | ||
|
||
// Discover information about given item from given jid. | ||
func (c *Client) DiscoverInfo(from string, to string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason to be able to define the from
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be able to do this. Query info about whether client is able to join muc or not, just before blindly try to join.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why not use c.Jid, e.g. as done here instead of making it configurable?
Is there any reason that you might have an connection of jid1 that would request this info claiming to be jid2? Actually I'd assume the server would not allow you to impersonate another JID, therefore I don't see why this should be made configurable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was about year ago, so i don't quite remember why, to be honest. But this mechanics works in conjunction with jabber.ru server and I have to use it this way, otherwise I did not suggest it as PR. If you see it questionable you can always close this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But in the example you linked me you also set from to your own JID (I'm pretty sure faking a JID wouldn't work anyway). So if you don't make it configurable but use c.jid, like DiscoverNodeInfo() does, your code should also work.
Just to make requests in conventional way.
In my case it is disco#info to MUC.